﻿using System;

namespace Eff.Data.Linq
{



    /// <summary>
    /// 分页信息结构体
    /// </summary>
    [Serializable]
    public class PageInfo
    {
        /// <summary>
        /// 获取或设置 当前页
        /// </summary>
        public int CurrentPage { get; set; }

        /// <summary>
        /// 获取或设置 页大小
        /// </summary>
        public int PageSize { get; set; }

        /// <summary>
        /// 获取或设置 记录数
        /// </summary>
        public int RecordCount { get; set; }

        /// <summary>
        /// 获取或设置 页数
        /// </summary>
        public int PageCount
        {
            get
            {
                return PageSize > 0 ? ((RecordCount - 1) / PageSize + 1) : 0;
            }
        }

        public static PageInfo GetDefaultPager()
        {
            var pager = new PageInfo { CurrentPage = 1, PageSize = 20 };
            return pager;
        }
    }
}
